package io.github.talelin.latticy.service;

import io.github.talelin.latticy.bo.MarkImageBO;
import io.github.talelin.latticy.entity.MarkImage;
import io.github.talelin.latticy.repository.MarkImageRepository;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

@Service
public class MarkImageService 
{
    @Autowired
    private MarkImageRepository markImageRepository;
    
    public void create(Long sendCollectId, List<String> images)
    {
        List<MarkImage> markImageList = new ArrayList<>();
        for (int i = 0; i < images.size(); i++) {
            MarkImage markImage = new MarkImage();
            markImage.setSort(i);
            markImage.setImage(images.get(i));
            markImage.setSendCollectId(sendCollectId);
            markImageList.add(i, markImage);
        }
        markImageRepository.saveAll(markImageList);
    }
}
